#!/bin/sh

####
#### Copyright (C) 2015
#### David Pirotte <david at altosw dot be>

#### This file is part of Guile-Squee.

#### Guile-Squee is free software: you can redistribute it and/or
#### modify it under the terms of the GNU Lesser General Public
#### License as published by the Free Software Foundation, either
#### version 3 of the License, or (at your option) any later version.

#### Guile-Squee is distributed in the hope that it will be useful,
#### but WITHOUT ANY WARRANTY; without even the implied warranty of
#### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#### Lesser General Public License for more details.

#### You should have received a copy of the GNU Lesser General Public
#### License along with Guile-Squee.  If not, see
#### <http://www.gnu.org/licenses/>.
####


top_srcdir="@abs_top_srcdir@"
top_builddir="@abs_top_builddir@"

[ x"$top_srcdir"   = x -o ! -d "$top_srcdir" -o \
  x"$top_builddir" = x -o ! -d "$top_builddir" ] && {
    echo $0: bad environment
    echo top_srcdir=$top_srcdir
    echo top_builddir=$top_builddir
    exit 1
}

if [ x"$GUILE_LOAD_PATH" = x ]
then
    GUILE_LOAD_PATH=$top_srcdir
else
    GUILE_LOAD_PATH=$top_srcdir:$GUILE_LOAD_PATH
fi

if [ x"$GUILE_LOAD_COMPILED_PATH" = x ]
then
    GUILE_LOAD_COMPILED_PATH=$top_srcdir
else
    GUILE_LOAD_COMPILED_PATH=$top_srcdir:$GUILE_LOAD_COMPILED_PATH
fi

if [ $top_srcdir != $top_builddir ]
then
    GUILE_LOAD_PATH=$top_builddir:$GUILE_LOAD_PATH
    GUILE_LOAD_COMPILED_PATH=$top_builddir:$GUILE_LOAD_COMPILED_PATH
fi

# echo $GUILE_LOAD_PATH
# echo $GUILE_LOAD_COMPILED_PATH
export GUILE_LOAD_PATH
export GUILE_LOAD_COMPILED_PATH

exec "$@"
